<?php get_header(); ?>
  <div class="container">
    <div class="content0 row">
      <div class="content0-left col-sm-5 col-md-5 col-lg-5">	  
		<div id="carousel-example-generic" class="carousel slide row" data-ride="carousel">
		  <ol class="carousel-indicators">
			<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
			<?php $i=1; 
			  while ($i<5) {
				  echo '<li data-target="#carousel-example-generic" data-slide-to="'.$i.'"></li>';
				  $i++;
			  };
			?>
		  </ol>
		  <div class="carousel-inner">
			<?php query_posts('showposts=1 & cat=array(38,49,50)'); ?>
			<?php if (have_posts()) : ?>   
			<?php while (have_posts()) : the_post(); ?>
			<div class="item index-carousel-inner active">
			  <a href="<?php the_permalink(); ?>"><img src="<?php echo catch_that_image(); ?>" alt="" /></a>
			  <div class="carousel-caption">
				<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
			  </div>
			</div>			
			<?php endwhile; ?>
			<?php endif; ?>
			<?php wp_reset_query(); ?>
			<?php query_posts('showposts=5 & cat=array(38,49,50)'); ?>
			<?php //忽略显示第一篇文章 ?>
			<?php if ( have_posts() ) : the_post(); ?> 
			<?php while ( have_posts() ) : the_post(); ?>
			<div class="item index-carousel-inner">
			  <a href="<?php the_permalink(); ?>"><img src="<?php echo catch_that_image(); ?>" alt="" /></a>
			  <div class="carousel-caption">
				<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
			  </div>
			</div>
			<?php endwhile;?>     
			<?php endif; ?>
			<?php wp_reset_query(); ?>
		  </div>
		</div>	  
	  </div>
	  <div class="content0-right col-sm-7 col-md-7 col-lg-7 right">
		<div class="row content0-right-inner">
		<?php query_posts('showposts=10 & cat=array(38,49,50) & offset=5'); ?>
		<?php if ( have_posts() ) : ?> 
		<?php while ( have_posts() ) : the_post(); ?>
		  <div class="col-sm-2 col-md-2 col-lg-2 index-news-singal">
		    <div class="row">
			  <div class="thumbnail index-news-thumb">
			    <?php the_post_thumbnail(); ?>
				<div class="caption index-news-title">
				  <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
				</div>
			  </div>
			</div>
		  </div>
		<?php endwhile;?>     
		<?php endif; ?>
		<?php wp_reset_query(); ?>
		</div>
      </div>
    </div>
  </div>
  <div class="content1">
	<div class="content1-inner">
    <div class="content1-left col-sm-9 col-md-9 col-lg-9">
	<div class="row content1-left-inner">
	  <!--左侧第一个栏目-->
	  <div class="index-newgames">
	  <div class="index-newgames-title">
	    <h2>尝鲜新作<small>最近大作</small><small>汉化img，等你来参与！</small></h2>
		<li class="divider-weight"></li>
	  </div>
	  <div class="index-newgames-body">
		<?php query_posts('showposts=10 & cat=array(6,7,8,9)'); ?>
		<?php if ( have_posts() ) : ?> 
		<?php while ( have_posts() ) : the_post(); ?>	  
	    <li class="index-newgames-singal">
		  <div class="index-games-thumb">
			<img src="<?php echo src_post_thumbnail(); ?>" alt="<?php the_title(); ?>" class="img-thumbnail">
		  </div>
		  <div class="index-games-title">
		    <span><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></span>
		  </div>
		  <div class="index-games-time">
		    <span><?php echo '日期:'.get_the_date('Y-m-d'); ?></span>
		  </div>		  
		</li>
		<?php endwhile;?>     
		<?php endif; ?>
	  </div>
	  </div>
	  <div class="clear"></div>
	  <!--左侧第二个栏目-->
	  <div class="index-goodgames">
	  <div class="index-newgames-title">
	    <h2>好评如潮<small>好评中文游戏</small></h2>
		<li class="divider-weight"></li>
	  </div>
	  <div class="index-newgames-body">
		<?php
		$post_num = 10;
		$args = array(
		    'post_status' => 'publish',
		    'cat' => 6,7,8,9,
		    'orderby' => 'comment_count',
		    'posts_per_page' => $post_num,
		);
		$query_posts = new WP_Query();
		$query_posts->query($args);
		while( $query_posts->have_posts() ) { $query_posts->the_post(); ?>	  
	    <li class="index-newgames-singal">
		  <div class="index-games-thumb">
			<img src="<?php echo src_post_thumbnail(); ?>" alt="<?php the_title(); ?>" class="img-thumbnail">
		  </div>
		  <div class="index-games-title">
		    <span><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></span>
		  </div>
		  <div class="index-games-comments">
		    <span><?php echo '评论量:'.get_post($post->ID)->comment_count; ?></span>
		  </div>
		</li>
        <?php } wp_reset_query(); ?>
	  </div>
	  </div>
	  <div class="index-hotgames">
	  <div class="index-newgames-title">
	    <h2>热门榜单<small>周榜单</small><small>月榜单</small><small>年榜单</small></h2>
		<li class="divider-weight"></li>
	  </div>
	  <div class="index-newgames-body">
		<?php echo gamux_get_hotpost(90, 10); ?>
	  </div>	  
	  </div>	  
	</div>
	</div>
	<!--右侧，使用sidebar形式-->
	<div class="content1-right col-sm-3 col-md-3 col-lg-3">
		<?php get_sidebar(); ?>
	</div>
	</div>
  </div>
  <!--首页使用库-->
  <!--首页布局-->
  <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/index.css">
<?php get_footer(); ?>
